with open('text.txt','wb') as f:
    a = 1001
    b = hex(a)
    print(b)
    f.write(b'\x01\x02\x03'+b'\x03')

